$('.loginSubmit').on('click',function() {
  let email = $("#loginEmail").val()
  let password = $("#loginPassword").val()
  if (email.trim().length == 0) {
    alert('请输入邮箱')
    return;
  }
  if (password.trim().length == 0) {
    alert('请输入密码')
  }
  $.ajax({
    type: 'post',
    url: '/login',
    data: {
      email: email,
      password: password
    },
    success: function(response) {
     if (response.role == 'admin') {
       location.href = '/admin/index.html'
     }else {
        location.href = "/index.html"
     }
    },
    error: function(response) {
      alert('用户名或密码错误')
    }
  })
  return false;
})